<!--home-->
<template>
  <div class="home">
    <div class="flex-v-center head" style="background-color: #1176AE">
      <div>
        <p style="color: #ffffff" class="head-text" >{{this.$route.name}}</p>
      </div>
    </div>

    <div class="home-index test-border flex-v-center">
      <HomeMenu  :menu="menu" @menuItemClick="menuItemClick" />
      <router-view />
    </div>

    <a-modal v-model="visible" title="上传参数" @ok="handleOk">
      <div style="width: 100%;height: 100%">
        <el-upload
            class="upload-demo"
            drag
            action="https://jsonplaceholder.typicode.com/posts/"
            multiple
            accept=".xlsx,.xls,.csv"
            :on-exceed="exceed"
            :limit="1"
            :http-request="uploadFile"
        >
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">
            将文件拖到此处，或
            <em>点击上传</em>
            <p>一次只能上传 1 个 .xlsx 或者 .csv文件</p>
          </div>
        </el-upload>
      </div>
    </a-modal>
  </div>
</template>

<script>
import HomeMenu from "@/components/home/HomeMenu";
import XLSX from "xlsx";
export default {
  //1这是用来获取每个前端页面路1由后面的token
  created () {
    let  str = window.location.href;
    if(str.match("id")){
      console.log(str);
      let wz=str.indexOf('=');
      let len=str.length;
      //截取token
      let token=str.substring(wz+1,len);
      console.log(token);

      //存储token
      localStorage.setItem("token",token);

      //取token
      console.log(localStorage.getItem(token));
    }
    else{
      console.log("当前不在index页面")
    }
    document.title = '精益传动'
    // let  str = window.location.href;
    if(str.match("id")){
      console.log(str);
      let wz=str.indexOf('=');
      let len=str.length;
      //截取token
      let token=str.substring(wz+1,len);
      console.log(token);

      //存储token
      localStorage.setItem("token",token);

      //取token
      console.log(localStorage.getItem(token));
    }
    else{
      console.log("当前不在index页面")
    }

    document.title = '精益传动'
  },
  name: "Home",
  components: {
    HomeMenu
  },
  data() {
    return {
//this.$store
      visible:false,
      dataList: this.$store.state.file.dataList,
      icons: ["minus", "border", "close"],
      menu: [
        {
          item: "文件",
          key: "1",
          subItem1: [
            { item: "打开参数", key: "1.1" },
            { item: "保存参数", key: "1.2" },
          ]
        },
      //   {
      //     item: "载荷",
      //     key: "2",
      //     subItem1: [
      //       { item: "载荷谱持续计数处理", key: "2.1" },
      //       { item: "载荷谱雨流计数处理", key: "2.2" },
      //       { item: "齿轮载荷持续谱分析", key: "2.4" },
      //       { item: "多自由度受载滚动轴承载荷分析", key: "2.5" }
      //     ]
      //   },
      //   {
      //     item: "材料",
      //     key: "3",
      //     subItem1: [
      //       { item: "常用材料的S-N曲线与海夫图", key: "3.1" },
      //     ]
      //   },
      //   {
      //     item: "传动比",
      //     key: "4",
      //     subItem1: [
      //       {
      //         item: "两级传动分配",
      //         key: "4.1",
      //         subItem2: [
      //           { item: "二级平行轴传动比分配", key: "4.1.1" },
      //           { item: "锥齿轮与圆柱齿轮传动比分配", key: "4.1.2" },
      //           { item: "锥齿轮与行星轮系传动比分配", key: "4.1.3" },
      //           { item: "两级双联齿轮传动比分配", key: "4.1.4" },
      //           { item: "两级NGW型行星轮系传动比分配", key: "4.1.5" },
      //           { item: "封闭差动（行星架输入）传动比分配", key: "4.1.6" },
      //           { item: "封闭差动（同齿圈）传动比分配", key: "4.1.7" }
      //         ]
      //       },
      //       {
      //         item: "三级传动分配",
      //         key: "4.2",
      //         subItem2: [
      //           { item: "一级行星轮+两级平行轴传动比分配", key: "4.2.1" },
      //           { item: "两级行星轮+一级平行轴传动比分配", key: "4.2.2" },
      //           { item: "封闭差动（行星架输入）+1级平行轴传动比分配", key: "4.2.3"},
      //           { item: "三级平行轴传动比分配", key: "4.2.4" },
      //           { item: "三级NGW型行星轮系传动比分配", key: "4.2.5" },
      //           { item: "三级封闭差动传动比分配", key: "4.2.7" },
      //         ]
      //       },
      //       {
      //         item: "四级传动分配",
      //         key: "4.3",
      //         subItem2: [
      //           { item: "两级行星轮+两级平行轴传动比分配", key: "4.3.1" },
      //           { item: "四级行星轮系传动比分配", key: "4.3.2" }
      //         ]
      //       }
      //     ]
      //   },
      //   {
      //     item: "齿轮",
      //     key: "5",
      //     subItem1: [
      //       {
      //         item: "齿轮宏观参数主动设计",
      //         key: "5.1",
      //         subItem2: [
      //           {
      //             item: "单级齿轮宏观参数主动设计",
      //             key: "5.1.1",
      //             subItem3: [
      //               {
      //                 item: "单级外啮合齿轮宏观参数设计",
      //                 key: "5.1.1.1"
      //               },
      //               {
      //                 item: "单级内啮合齿轮宏观参数设计及优化",
      //                 key: "5.1.1.2"
      //               },
      //               {
      //                 item: "行星轮系齿轮宏观参数设计",
      //                 key: "5.1.1.3"
      //               },
      //
      //               {
      //                 item: "锥齿轮宏观参数设计",
      //                 key: "5.1.1.6"
      //               }
      //             ]
      //           },
      //           {
      //             item: "两级宏观参数主动设计",
      //             key: "5.1.2",
      //             subItem3: [
      //               {
      //                 item: "两级NGW型平行轴系宏观参数设计及优化",
      //                 key: "5.1.2.1"
      //               },
      //               {
      //                 item: "两级行星轮系NGW齿轮宏观参数设计及优化",
      //                 key: "5.1.2.3"
      //               },
      //               {
      //                 item: "封闭差动（同齿圈输出）",
      //                 key: "5.1.2.4"
      //               },
      //               {
      //                 item: "封闭差动（行星架输入）",
      //                 key: "5.1.2.5"
      //               }
      //             ]
      //           },
      //           {
      //             item: "三级宏观参数主动设计",
      //             key: "5.1.3",
      //             subItem3: [
      //               {
      //                 item: "两级行星+一级平行轴齿轮传动",
      //                 key: "5.1.3.1"
      //               },
      //               {
      //                 item: "封闭差动+一级平行轴齿轮传动主动设计",
      //                 key: "5.1.3.2"
      //               },
      //               {
      //                 item: "一级行星轮+两级平行轴齿轮传动",
      //                 key: "5.1.3.3"
      //               },
      //               {
      //                 item: "三级行星轮系齿轮传动",
      //                 key: "5.1.3.4"
      //               },
      //               { item: "三级封闭差动行星轮系齿轮传动宏观参数设计及优化", key: "4.2.8" }
      //             ]
      //           }
      //         ]
      //       },
      //       {
      //         item: "齿轮强度校核",
      //         key: "5.2",
      //         subItem2: [
      //           {
      //             item: "外啮合齿轮强度校核",
      //             key: "5.2.1"
      //           },
      //           {
      //             item: "内啮合齿轮强度校核",
      //             key: "5.2.2"
      //           },
      //           {
      //             item: "行星轮系齿轮强度校核",
      //             key: "5.2.3"
      //           },
      //           {
      //             item: "锥齿轮强度校核",
      //             key: "5.2.5"
      //           },
      //           {
      //             item: "差速器锥齿轮静强度安全系数校核",
      //             key: "5.2.6"
      //           }
      //         ]
      //       },
      //       {
      //         item: "齿轮接触应力与传递误差分析",
      //         key: "5.5",
      //         subItem2: [
      //           {
      //             item: "外啮合齿轮齿面接触应力与传递误差分析",
      //             key: "5.5.1"
      //           },
      //           {
      //             item: "内啮合齿轮齿面接触应力与传递误差分析",
      //             key: "5.5.2"
      //           }
      //         ]
      //       },
      //       {
      //         item: "齿轮渗碳、渗氮层深度计算",
      //         key: "5.6"
      //       },
      //       {
      //         item: "轮系均载分析",
      //         key: "5.7",
      //         subItem2: [
      //           {
      //             item: "行星轮轮系",
      //             key: "5.7.1",
      //             subItem3: [
      //               {
      //                 item: "行星轮系均载初步分析",
      //                 key: "5.7.1.1"
      //               },
      //               {
      //                 item: "行星轮系均载综合分析",
      //                 key: "5.7.1.2"
      //               }
      //             ]
      //           },
      //           {
      //             item: "功率分流轮系（WW型）",
      //             key: "5.7.2",
      //             subItem3: [
      //               {
      //                 item: "功率分流轮系均载初步分析（WW型）",
      //                 key: "5.7.2.1"
      //               },
      //               {
      //                 item: "功率分流轮系均载综合分析（WW型）",
      //                 key: "5.7.2.2"
      //               }
      //             ]
      //           },
      //           {
      //             item: "功率分流轮系（NW型）",
      //             key: "5.7.3",
      //             subItem3: [
      //               {
      //                 item: "功率分流轮系均载初步分析（NW型）",
      //                 key: "5.7.3.1"
      //               },
      //               {
      //                 item: "功率分流轮系均载综合分析（NW型）",
      //                 key: "5.7.3.2"
      //               }
      //             ]
      //           }
      //         ]
      //       },
      //       {
      //         item: "齿轮胶合与磨损计算",
      //         key: "5.8",
      //         subItem2: [
      //           {
      //             item: "齿轮胶合与磨损计算（积温）",
      //             key: "5.8.1"
      //           },
      //           {
      //             item: "齿轮胶合与磨损计算（闪温）",
      //             key: "5.8.2"
      //           },
      //           {
      //             item: "齿轮胶合与磨损计算（AGMA）",
      //             key: "5.8.3"
      //           }
      //         ]
      //       },
      //       {
      //         item: "齿轮修形设计与计算",
      //         key: "5.11",
      //         subItem2: [
      //           {
      //             item: "齿轮参考修形设计",
      //             key: "5.11.1"
      //           },
      //         ]
      //       },
      //       {
      //         item: "齿轮微点蚀计算",
      //         key: "5.14"
      //       }
      //     ]
      //   },
      //   {
      //     item: "轴系",
      //     key: "6",
      //     subItem1: [
      //       { item: "参考最小轴径计算", key: "6.1" },
      //       { item: "轴疲劳及径强度计算", key: "6.3" },
      //       {
      //         item: "轴振动计算",
      //         key: "6.4",
      //         subItem2: [
      //           { item: "简单的轴振动计算",
      //             key: "6.4.1" ,
      //           },
      //           { item: "轴的临界转速计算", key: "6.4.2" },
      //         ]
      //       },
      //     ]
      //   },
      //   {
      //     item: "轴承",
      //     key: "7",
      //     subItem1: [
      //       {
      //         item: "滚动轴承寿命估算",
      //         key: "7.1",
      //         subItem2: [
      //           { item: "两个圆柱滚子+四点接触球",
      //             key: "7.1.1",
      //             subItem3: [
      //               { item: "四点接触球轴承滚动体受载与寿命计算",
      //                 key: "7.1.1.1"
      //               },
      //               { item: "单向/双向推力圆柱滚子轴承滚动体受载与寿命计算",
      //                 key: "7.1.1.2"
      //               },
      //               { item: "单列/双列深沟球轴承滚动体受载与寿命计算",
      //                 key: "7.1.1.3"
      //               }  ]
      //           },
      //           { item: "两个圆锥滚子（行星轮轴承）", key: "7.1.2" ,
      //             subItem3: [
      //               { item: "单列/双列圆柱滚子轴承滚动体受载与寿命计算",
      //                 key: "7.1.2.1"
      //               },
      //               { item: "单列/双列滚针轴承滚动体受载与寿命计算",
      //                 key: "7.1.2.2"
      //               },
      //               { item: "单向/双向推力球轴承滚动体受载与寿命计算",
      //                 key: "7.1.2.3"
      //               }
      //             ]
      //           },
      //           { item: "两个角接触轴承", key: "7.1.3",
      //             subItem3: [
      //               { item: "单列/双列角接触球轴承滚动体受载与寿命计算",
      //                 key: "7.1.3.1"
      //               },
      //               { item: "调心球轴承滚动体受载与寿命计算",
      //                 key: "7.1.3.2"
      //               },
      //               { item: "推力角接触球轴承滚动体受载与寿命计算",
      //                 key: "7.1.3.3"
      //               }
      //             ]},
      //           { item: "两个圆锥滚子", key: "7.1.4" ,
      //             subItem3: [
      //               { item: "单列/双列圆锥滚子轴承滚动体受载与寿命计算",
      //                 key: "7.1.4.1"
      //               },
      //               { item: "球面滚子轴承滚动体受载与寿命计算",
      //                 key: "7.1.4.2"
      //               },
      //               { item: "单向/双向推力滚针轴承滚动体受载与寿命计算",
      //                 key: "7.1.4.3"
      //               }
      //             ]
      //           }
      //         ]
      //       },
      //       { item: "滚动轴承游隙计算", key: "7.2" },
      //       { item: "轴承配合设计及校核", key: "7.5" }
      //     ]
      //   },
      //   {
      //     item: "联接",
      //     key: "8",
      //     subItem1: [
      //       { item: "过盈设计与校核", key: "8.1" },
      //       { item: "平键强度校核", key: "8.2" },
      //       {
      //         item: "花键设计与校核",
      //         key: "8.3",
      //         subItem2: [
      //           {
      //             item: "渐开线花键",
      //             key: "8.3.1",
      //             subItem3: [
      //               { item: "花键参数设计", key: "8.3.1.1" },
      //               { item: "花键强度校核", key: "8.3.1.2" }
      //             ]
      //           },
      //         ]
      //       },
      //       { item: "销连接强度校核", key: "8.5" },
      //       {
      //         item: "螺钉/螺栓联接设计与校核",
      //         key: "8.6",
      //         subItem2: [
      //           { item: "螺钉/螺栓预紧力计算", key: "8.6.1" },
      //           { item: "高强度螺栓设计与校核", key: "8.6.2" },
      //           { item: "单自由度载荷时螺钉/螺栓强度校核", key: "8.6.3" },
      //           { item: "多自由度载荷时螺钉/螺栓强度校核", key: "8.6.4" }
      //         ]
      //       },
      //     ]
      //   },
      //   {
      //     item: "疲劳",
      //     key: "9",
      //     subItem1: [
      //       {
      //         item: "铸铁或铸钢件疲劳强度计算",
      //         key: "9.1"
      //       },
      //       {
      //         item: "合金钢件疲劳强度计算",
      //         key: "9.2"
      //       }
      //     ]
      //   },
      //   {
      //     item: "润滑",
      //     key: "10",
      //     subItem1: [
      //       {
      //         item: "热损失计算",
      //         key: "10.1",
      //         subItem2: [
      //           {
      //             item: "齿轮功率损失",
      //             key: "10.1.1",
      //             subItem3: [
      //               {
      //                 item: "高速圆柱齿轮功率损失",
      //                 key: "10.1.1.1",
      //                 subItem4: [
      //                   { item: "行星轮系齿轮功率损失", key: "10.1.1.1.2" }
      //                 ]
      //               },
      //               {
      //                 item: "通用圆柱齿轮功率损失",
      //                 key: "10.1.1.2",
      //                 subItem4: [
      //                   { item: "平行轴齿轮功率损失", key: "10.1.1.2.1" },
      //                 ]
      //               },
      //             ]
      //           },
      //           { item: "轴承功率损失", key: "10.1.2" },
      //           {
      //             item: "其他损失",
      //             key: "10.1.3",
      //             subItem3: [
      //               { item: "油封和油泵损失", key: "10.1.3.2" }
      //             ]
      //           }
      //         ]
      //       },
      //       {
      //         item: "润滑油量及油路计算",
      //         key: "10.2",
      //         subItem2: [{ item: "单个喷孔流量计算", key: "10.2" }]
      //       }
      //     ]
      //   },
      //   {
      //     item: "专家知识系统",
      //     key: "11",
      //   },
      ]
    };
  },
  methods: {
    downloadFile(){
// 要导出的json数据
      const key = this.$store.state.file.key
      const jsonData = this.$store.state.file.dataList[key];
      const  keys = Object.keys(jsonData)
      const length = Object.keys(jsonData).length
      // 列标题，逗号隔开，每一个逗号就是隔开一个单元格
      let str = `params,value\n`;
      // 增加\t为了不让表格显示科学计数法或者其他格式
      for(let i = 0 ; i < length ; i++ ){
        str+=`${keys[i]+ '\t'},`;
        str+=`${jsonData[keys[i]]+ '\t'},`;
        str+='\n';
      }
// encodeURIComponent解决中文乱码
      const uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str);
      // 通过创建a标签实现
      const link = document.createElement("a");
      link.href = uri;
      // 对下载的文件命名
      const name_str = this.$route.name.toString();
      link.download =  name_str+".csv";
      this.$message.success(name_str  + " csv文件参数保存成功");
      link.click();
    },
    async uploadFile(params) {
// if(this.$store.state.file.key == "1.2"){}
      const key = this.$store.state.file.key
      console.log("key = " + key)
      const _file = params.file;
      console.log(_file.name)
      this.$message.success(_file.name + "文件上传成功");
      const fileReader = new FileReader();
      fileReader.onload = (ev) => {
        try {
          const data = ev.target.result;
          const workbook = XLSX.read(data, {
            type: 'binary'
          });
          for (let sheet in workbook.Sheets) {
          //循环读取每个文件
            console.log("key = " + key)
            let rowTable = this.$store.state.file.dataList[key];
            console.log(sheet)
            const sheetArray = XLSX.utils.sheet_to_json(workbook.Sheets[sheet]);
            //若当前sheet没有数据，则continue
            // if(sheetArray.length == 0){
            //   continue;
            // }
            // console.log("读取文件");
            // console.log(sheetArray);
            // console.log(sheetArray[0]);
            // console.log(this.dataList[key][2])
            for(let item in sheetArray){
              let keys_F = Object.keys(rowTable)
              // console.log(keys_F)
              for(let i in keys_F ){
                  sheetArray[item].params = sheetArray[item].params.replace("\t",'')
                if(sheetArray[item].params.toString() == keys_F[i].toString()){
                  console.log("匹配成功" )
                  const key = keys_F[i]
                  rowTable[key]= sheetArray[item].value
                  // console.log(rowTable)
                }
              }
            }
          }
        } catch (e) {
// this.$message.warning('文件类型不正确！');
        }
      };
      fileReader.readAsBinaryString(_file);
    },

    exceed: function() {
      this.$message.error("最多只能上传 1 个 .xlsx 或者 .csv文件");
    },
    //删除文件
    remove() {
      console.log("删除 文件")
       this.dataList = [];
    },
    handleOk(){
      this.visible = false;
    },
    menuItemClick(n) {
      console.log(n);
      if(n.key === "1.1"){
        this.visible = true;
      }else if(n.key === "1.2"){
        this.downloadFile()
      }
      else if (n.key === "1.3") {
        this.$router.push({
          path: "/file/help"
        });
      }else if (n.key === "11") {
        const {href} = this.$router.resolve({
          path:"/main"});
        window.open(href, "_blank");
      }
      else if (n.key === "2.2") {
        const {href} = this.$router.resolve({
          path:"/Load/nameRFC_matrix_deal"        });
        window.open(href, "_blank");

      }
      else if (n.key === "3.1") {
        const {href} = this.$router.resolve({
          path:"/material/material_SNHF"
        });
        window.open(href, "_blank");
      }else if (n.key === "4.1.2") {
        const {href} = this.$router.resolve({
          path:"/two_transmission/bevelAndCylindrical_Gears"
        });
        window.open(href, "_blank");
      }else if (n.key === "4.1.3") {
        //锥齿轮与行星轮系传动比分配
        const {href} = this.$router.resolve({
          path: "/two_transmission/bevel_planet_gear_ratio1"
        });
        window.open(href, "_blank");
      }else if (n.key === "4.2.1") {//1级行星轮+2级平行轴传动比分配
        const {href} =this.$router.resolve( {
          path:"/transmissionRatio/third_Transmission_Ratio/OptiRatio_oneplanet_add_twoparallel_last0814"
        });
        window.open(href,"_blank");
        /*window.open("/transmissionRatio/third_Transmission_Ratio/OptiRatio_oneplanet_add_twoparallel_last0814", "_blank");*/
      }else if (n.key === "4.2.5") {  //78三级NGW型行星轮系传动比分配
        const {href} = this.$router.resolve({
          path:"/Transmission/three_transmission/OptiRatio_3stageP_increase_last"
        });
        window.open(href, "_blank");
      }else if(n.key === "4.3.1"){  //2-14两级行星轮+两级NGW型平行轴传动比分配  wsl
        const {href} = this.$router.resolve({
          path:"/four_transmission/optiRatio_twoplanet_add_twoparallel_last"
        });
        window.open(href, "_blank");
      }else if (n.key === "5.1.2.3") {
        //两级行星轮系NGW齿轮宏观参数设计及优化
        const {href} = this.$router.resolve({
          path: "/two_design_gear/two_planet_design_check_last_sn_20140930"
        });
        window.open(href, "_blank");
      }else if(n.key === "5.2.6"){   //差速器锥齿轮静强度校核
        const {href} = this.$router.resolve({
          path:"/bolt_screw_strap/gear_zhui"
        });
        window.open(href, "_blank");
      }else if(n.key === "5.2.5"){   //1-9锥齿轮强度校核
        const {href} = this.$router.resolve({
          path:"/strength_check_gear/bevel_gear_strength_safty_facor_Damege"
        });
        window.open(href, "_blank");
      }else if (n.key === "5.5.1") { //28外啮合齿面接触应力、传递误差分析及优化
        const {href} = this.$router.resolve({
          path:"/stress_error_gear/Nametransmisson"
        });
        window.open(href, "_blank");
      }else if (n.key === "5.6") {
        //齿轮渗碳氮深度计算
        const {href} = this.$router.resolve({
          path: "/Gear/case_depth"
        });
        window.open(href, "_blank");
      }else if(n.key === "5.7.1.1"){ //2-30行星轮轮系均载初步分析
        const {href} = this.$router.resolve({
          path:"/planetary_gear/loadshare_planet"
        });
        window.open(href, "_blank");
      }else if(n.key === "5.14"){   //11齿轮微点蚀计算
        const {href} = this.$router.resolve({
          path:"/Gear/gear_Micro_pitting_Calculation_helical_gear"
        });
        window.open(href, "_blank");
      }else if (n.key === "6.1") {//参考最小轴径计算
        const {href} =this.$router.resolve( {
          path:"/Shafting/API613_Check_Min_shaft_diameter"
        });
        window.open(href,"_blank");
        /*window.open("/Shafting/API613_Check_Min_shaft_diameter", "_blank");*/
      }else if(n.key === "6.4.2"){  // 轴的临界转速计算
        const {href} = this.$router.resolve({
          path:"/vibration_shaft/critical_rotate_speed"
        });
        window.open(href, "_blank");
      }else if (n.key === "7.1.4.1") {       //txh
        //单列/双列圆锥滚子轴承滚动体受载与寿命计算 (这个不在禅道，随便设的
        const {href} = this.$router.resolve({
          path: "/Bear/rolling_life_bear/two_tap_rollers/module_double_taper_rollerbearing_cal_last_z"
        });
        window.open(href, "_blank");
      }else if (n.key === "7.1.3.3") {  //推力角接触球轴承滚动体受载与寿命计算
        const {href} = this.$router.resolve({
          path:"/Bear/rolling_life_bear/two_angular_con_bearings/namemodule_bevel_gear_strength_static"
        });
        window.open(href, "_blank");
      }else if (n.key === "7.2") { //35滚动轴承游隙计算
        const {href} = this.$router.resolve({
          path:"/Bear/module_bearing_clearance"
        });
        window.open(href, "_blank");
      }else if (n.key === "8.1") { //37过盈配合设计计算
        const {href} = this.$router.resolve({
          path:"/Strap/Interference_design"
        });
        window.open(href, "_blank");
      }else if(n.key === "8.6.3"){  //1-44单自由度载荷时螺栓/螺钉强度校核
        const {href} = this.$router.resolve({
          path:"/bolt_screw_strap/single_bolt_check1"
        });
        window.open(href, "_blank");
      }else if (n.key === "9.2") {  //47合金钢件疲劳强度计算（GL）
        const {href} = this.$router.resolve({
          path:"/Fatigue/hammersmith_S_N"
        });
        window.open(href, "_blank");
      }else if (n.key === "2.4") {
        const {href} = this.$router.resolve({
          path: "/load//nameloadspectrum_bending"
        });
        window.open(href, "_blank");
      } else if (n.key === "2.5") {//多自由度受载滚动轴承载荷分析
        const {href} =this.$router.resolve( {
          path:"/load/Mutiaxes_Load_Bearing"
        });
        window.open(href,"_bLank");
      }else if (n.key === "8.3.1.2") {
        const {href} = this.$router.resolve({
          path: "/spline_SAE"
        });
        window.open(href, "_blank");
      } else if (n.key === "8.6.1") {
        const {href} = this.$router.resolve({
          path: "/namebolt_preload_1"
        });
        window.open(href, "_blank");
      } else if (n.key === "5.1.3.4") {
        const {href} = this.$router.resolve({
          path: "/three_planet_design_check_last_sn"
        });
        window.open(href, "_blank");
      } else if (n.key === "10.1.1.2.1") {
        //平行轴啮合损失
        const {href} = this.$router.resolve({
          path: "/general_purpose_lubrication/pingxingzhouniehesunshi"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "4.2.6") {
        //3级封闭差动齿轮宏观参数设计(这个不在禅道，随便设的
        const {href} = this.$router.resolve({
          path: "/Transmission/three_transmission/sanjifengbichadong"
        });
        window.open(href, "_blank");
      }else if (n.key === "4.2.7") {//3级封闭差动传动比分配
        const {href} =this.$router.resolve( {
          path:"/transmissionRatio/third_Transmission_Ratio/OptiRatio_3stageR_reduction_last"
        });
        window.open(href,"_blank");
      }
      else if (n.key === "4.2.8") {  //3级封闭差动齿轮宏观参数设计
        const {href} =this.$router.resolve( {
          path:"/Transmission/three_transmission/sanjifengbichadong"
        });
        window.open(href,"_blank");
      }
      //ljj
      else if (n.key === "2.1") { //载荷谱持续计数处理
        const {href} = this.$router.resolve({
          path:"/load/LDD_matrix_deal"
        });
        window.open(href, "_blank");
      }else if (n.key === "5.7.3.2") { //功率分流轮系均载综合分析（NW型）
        const {href} = this.$router.resolve({
          path:"/gear/namemuti_power_loadshare_NW_statistics"
        });
        window.open(href, "_blank");
      }else if (n.key === "5.1.1.6") { //锥齿轮宏观参数设计
        const {href} = this.$router.resolve({
          path:"/gear/namebevel_geaer_active_design"
        });
        window.open(href, "_blank");
      }else if (n.key === "2.1") {//载荷谱持续计数处理
        const {href} = this.$router.resolve({
          path: "/Load/LDD_matrix_deal"
        });
        window.open(href, '_blank');
      }else if (n.key === "5.11.1") {//齿轮参考修形设计
        const {href} = this.$router.resolve({
          path: "/Gear/modification_gear/gear_design"
        });
        window.open(href, '_blank');
      }else if (n.key === "4.1.4") {
        const {href} = this.$router.resolve({//两级双联齿轮传动比分配
          path: "/Transmission/two_transmission/optiRatio_twoparallel_2_6_last"
        });
        window.open(href, '_blank');
      }else if (n.key === "5.1.2.1") {//两级平行轴齿轮宏观参数设计及优化
        const {href} = this.$router.resolve({
          path: "/Gear/macroscopic_design_gear/two_design_gear/two_parallel_design_last_sn"
        });
        window.open(href, '_blank');
      }else if (n.key === "5.1.1.1") {//平行轴外啮合齿轮宏观参数设计
        const {href}=this.$router.resolve({
          path:"/one_design_gear/check2-16-1"
        });
        window.open(href, "_blank");
      }else if (n.key === "4.1.1") {//二级平行轴传动比分配
        const {href}=this.$router.resolve({
          path:"/two_transmission/check2-01"
        });
        window.open(href, "_blank");
      }else if (n.key === "7.1.1.3") {//双列深沟球
        const {href}=this.$router.resolve({
          path:"/two_cy_rollers_four_con_ball/module_double_radial_ballbearing_cal_last"
        });
        window.open(href, "_blank");
      }else if (n.key === "7.1.3.2") {//调心球轴承
        const {href}=this.$router.resolve({
          path:"/two_angular_con_bearings/module_selfalign_ballbearing_cal_last"
        });
        window.open(href, "_blank");
      }else if (n.key === "7.1.4.2") {//调心滚子
        const {href}=this.$router.resolve({
          path:"/two_tap_rollers/module_radial_spher_rollerbearing_cal_last_z"
        });
        window.open(href, "_blank");
      }else if (n.key === "5.2.1") {//外啮合齿轮强度校核
        const {href}=this.$router.resolve({
          path:"/strength_check_gear/parallel_external_fatiguesafe_check"
        });
        window.open(href, "_blank");
      }else if (n.key === "4.3.2") {//4级行星轮系传动比分配
        const {href} = this.$router.resolve({
          path:"/four_transmission/OptiRatio_4stageP_increase_last"
        });
        window.open(href,"_blank");
      }else if (n.key === "8.2") {//平键强度校核
        const {href} = this.$router.resolve({
          path:"/Strap/Calculation_Paraller_Key"
        });
        window.open(href,"_blank");
      }else if (n.key === "7.1.1.2") {//推力圆柱与推力滚针轴承
        const {href} = this.$router.resolve({
          path:"/two_cy_rollers_four_con_ball/namemodule_thrust_rollerbearing_cal_last_z"
        });
        window.open(href,"_blank");
      }else if (n.key === "8.6.4") {//多自由度载荷时螺钉/螺栓强度校核
        const {href} = this.$router.resolve({
          path:"/bolt_screw_strap/multi_bolt"
        });
        window.open(href,"_blank");
      }else if (n.key === "5.7.1.2") {//行星轮轮系均载综合分析
        const {href} = this.$router.resolve({
          path:"/planetary_gear/planet_loadshare_statistics"
        });
        window.open(href,"_blank");
      }else if (n.key === "5.7.2.1") {//功率分流轮系均载初步分析（WW型）
        const {href}=this.$router.resolve({
          path:"/train_load_gear/check2-32"///Power_split_gear_train_WW_type/namemuti_power_loadshare_double_work_statistics
        });
        window.open(href, "_blank");
      }
      else if (n.key === "10.1.2") {  //轴承功率损失
        const {href} = this.$router.resolve({
          path:"/Lubrication/bearing_power_loss"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "7.1.3.1") {//双列角接触
        const {href}=this.$router.resolve({
          path:"/two_angular_con_bearings/double_row_angular_contact"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "7.1.2.3") {//推力球轴承分析
        const {href}=this.$router.resolve({
          path: "/two_tap_rollers_pla_gear_bear/thrust_ball_bearing"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "4.1.6") {//58 封闭差动（行星架输入）传动比分配
        const {href}=this.$router.resolve({
          path:"/two_transmission/closed_differential_planetary"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "5.8.3") {
        const { href } = this.$router.resolve({
          path:
              "/gluing_wear_gear/evaluating_scuffing_risk"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "7.1.2.1") {
        const { href } = this.$router.resolve({
          path:
              "/two_tap_rollers_pla_gear_bear/namemodule_double_cylin_rollerbearing_cal_last_z"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "4.1.7") {
        const { href } = this.$router.resolve({
          path:
              "/two_transmission/nameOptiRatio_2stageR_reduction_last"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "7.5") {//// 36轴承配合设计及校核
        const { href } = this.$router.resolve({
          path: "/Bear/moudule_bearing_fit"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "9.1") {  //铸铁或铸钢件疲劳强度计算（GL）
        const {href} = this.$router.resolve({
          path: "/Shaft/cast_steel_S_N_1"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "6.3") {  //轴疲劳静、强度计算
        const {href} = this.$router.resolve({
          path: "/Fatigue/CAL_Safety2"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "4.2.2") {  //两级行星轮+一级平行轴传动比分配
        const {href} = this.$router.resolve({
          path:"/three_transmission/nameOptiRatio_twoplanet_add_oneparallel_last"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "5.1.3.1") {//两级NGW型行星+一级平行轴齿轮传动宏观参数设计及优化
        const {href} = this.$router.resolve({
          path: "/three_design_gear/nametwo_planet_add_one_parallel_design_check"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "2.4") {
        const {href} = this.$router.resolve({
          path: "/Load/nameloadspectrum_bending"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "7.1.1.1") {
        const {href} = this.$router.resolve({
          path: "/two_cy_rollers_four_con_ball/module_four_point_contact_ballbearing_cal_last"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "8.3.1.2") {
        const {href} = this.$router.resolve({
          path: "/bolt_screw_strap/spline_SAE"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "10.1.3.2") {
        const { href } = this.$router.resolve({
          path:
              "/other_loss_lubrication/lubricate_youfengandyoubeng"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "5.1.3.4") {
        const {href} = this.$router.resolve({
          path: "/two_design_gear/three_planet_design_check_last_sn"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "4.2.3") {
        const {href} = this.$router.resolve({
          path: "/three_transmission/nameOpti"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "5.1.3.2") {
        const { href } = this.$router.resolve({
          path:
              "/three_design_gear/star_differ_one_parallel_design_last"
        });
        window.open(href, "_blank");
      }else if (n.key === "5.1.3.3") {//1级行星轮+2级平行轴齿轮传动
        const {href} =this.$router.resolve( {
          path:"/gear/one_planet_add_two_parallel_design_last_sn_20140930"
        });
        window.open(href,"_blank");
      } else if (n.key === "5.8.1")  {//14齿轮胶合与磨损计算（积温）
        const{href}=this.$router.resolve({
          path: "/gluing_wear_gear/gear_jiwen"
        });
        window.open(href,"_blank");
      }else if (n.key === "6.4.1") {
        const { href } = this.$router.resolve({
          path:"/Shafting/vibration_longitude",
        });
        window.open(href, "_blank");
      } else if (n.key === "10.2") {
        alert("适用于喷孔长度/喷口直径>0.5")
        const { href } = this.$router.resolve({
          path:"/lubricating/flowrate_of_nozzle",
        });
        window.open(href, "_blank");
      } else if(n.key === "5.7.3.1"){
        const { href } = this.$router.resolve({
          path:"/gear/muti_power_loadshare_NW",
        });
        window.open(href, "_blank");
      } else if (n.key === "5.1.1.3"){
        const { href } = this.$router.resolve({
          path:"/gear/planet_design_check_last",
        });
        window.open(href, "_blank");
      } else if (n.key === "8.3.1.1"){
        const { href } = this.$router.resolve({
          path:"/Connection/moudule_SplineDesign",
        });
        window.open(href, "_blank");
      }else if (n.key === "10.1.1.1.2")  {//49行星轮系齿轮功率损失
        const{href}=this.$router.resolve({
          path: "/high_speed_lubrication/lubricating_xingxinglunxi"
        });
        window.open(href,"_blank");
      }else if (n.key === "4.1.5")  {
        const{href}=this.$router.resolve({//57两级NGW型行星轮系传动比分配
          path: "/two_transmission/increase_last"
        });
        window.open(href,"_blank");
      }else if (n.key === "5.1.2.4")  {//73封闭差动（同齿圈输出）
        const{href}=this.$router.resolve({
          path: "/two_design_gear/star_differ_planet"
        });
        window.open(href,"_blank");
      }else if (n.key === "3.2")  {//82差速器锥齿轮强度校核
        const{href}=this.$router.resolve({
          path: "/bolt_screw_strap/gear_zhui"
        });
        window.open(href,"_blank");
      }else if (n.key === "5.7.3.2") {//1级行星轮+2级平行轴齿轮传动
        const {href} =this.$router.resolve( {
          path:"/gear/namemuti_power_loadshare_NW_statistics"
        });
        window.open(href,"_blank");
      }
      else if (n.key === "5.1.1.6") {//单级锥齿轮宏观参数设计及优化
        const {href} =this.$router.resolve( {
          path:"/gear/namebevel_geaer_active_design"
        });
        window.open(href,"_blank");
      }
      else if (n.key === "5.8.2") {//15齿轮胶合计算（闪温）
        const {href}=this.$router.resolve({
          path:"/gluing_wear_gear/gear_flash_temperature_a"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "5.1.2.5") {//任务2-22 封闭差动（行星架输入）宏观参数设计及优化
        const {href}=this.$router.resolve({
          path:"/two_design_gear/closed_differential_planet"
        });
        window.open(href, "_blank");
      }
      else if (n.key === "8.5") {
        // 销连接强度校核
        const {href} = this.$router.resolve({
          path: "/pin_strength_calculation"
        });
        window.open(href,"_blank");
      }else if (n.key === "4.2.4") {
        //3级平行轴传动比分配
        const {href} = this.$router.resolve({
          path: "/three_transmission"
        });
        window.open(href,"_blank");
      }else if (n.key === "5.2.3") {
        //行星轮系齿轮宏观参数校核
        const {href} = this.$router.resolve({
          path: "/strength_check_gear"
        });
        window.open(href,"_blank");
      }else if (n.key === "5.5.2") {
        // 内齿合齿轮齿面接触应力与传递误差分析
        const {href} = this.$router.resolve({
          path: "/stress_error_gear"
        });
        window.open(href,"_blank");
      }else if (n.key === "7.1.4.3") {
        //单列深沟球
        const {href} = this.$router.resolve({
          path: "/two_cy_rollers_four_con_ball/module_single_radial_ballbearing_cal_last"
        });
        window.open(href,"_blank");
      }
      else if (n.key === "5.1.1.2") {//2-17单级内啮合齿轮宏观参数设计及优化
        const {href}=this.$router.resolve({
          path:"/one_design_gear/nameparallel_external_design_check_internal"
        });
        window.open(href,"_blank");
      } else if (n.key === "8.6.2") {//42高强度螺栓设计与校核
        const {href}=this.$router.resolve({
          path:"/bolt_screw_strap/namebolt_strength"
        });
        window.open(href,"_blank");
      } else if (n.key === "5.2.2") {//07内啮合齿轮强度校核
        const {href}=this.$router.resolve({
          path:"/rength_check_gear/Internal_gear_strength_check"
        });
        window.open(href,"_blank");
      }
      else if (n.key === "5.7.2.2") {//2-33功率分流轮系均载综合分析（WW型）
        const {href}=this.$router.resolve({
          path:"/power_split_WW_gear/namemuti_power_loadshare_double_work_statistics"
        });
        window.open(href, "_blank");
      }else if (n.key === "7.1.2.2") {//单列径向滚子轴承5.2.1
        const {href}=this.$router.resolve({
          path:"/two_tap_rollers/module_single_radial_rollerbearing_cal_last_z"
        });
        window.open(href,"_blank");
      }

    }
  }
};
</script>

<style>
.home {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
}
.home > div:nth-child(1) {
  background-color: #262430;
  width: 100%;
  justify-content: space-between;
  padding: 13px 16px;
}
.icon-con {
  margin: 0 5px;
  border-radius: 50%;
  background-color: #686868;
  padding: 3px;
}
.icon-con:hover {
  cursor: pointer;
}

.home-index {
  background-color: #ffffff;
  height: 100%;
  width: 100%;
  flex-direction: column;
  justify-content: space-between;
}
</style>

